<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="main">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>学生显示</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#addStudent").click(function() {
			window.location.href = "/addStudentHTML";
		});
	});
</script>
</head>
<body>
	<div layout:fragment="content">
		<div class="place">
			<span>位置：</span>
			<ul class="placeul">
				<li><a href="/ordering/home">首页</a></li>
				<li><a href="#">学生信息</a></li>
			</ul>
		</div>

		<div class="rightinfo">
			<div class="tools">
				<ul class="toolbar">
					<li id="addStudent"><span><img src="images/t01.png" /></span>添加</li>
				</ul>
			</div>
			<form action="getStudent" method="post">
				<div class="container">
					<div class="row">
						<div class="col">
							<input type="text" name="school.name"
								th:value="${student.school} eq null ? '':${student.school.name}"
								placeholder="请输入学校" class="form-control" aria-label="Large"
								aria-describedby="inputGroup-sizing-sm" />
						</div>
						<div class="col">
							<input type="text" name="mobile" th:value="${student.mobile}"
								placeholder="请输入手机号" class="form-control" aria-label="Large"
								aria-describedby="inputGroup-sizing-sm" />
						</div>
						<div class="col">
							<input type="text" name="name" th:value="${student.name}"
								placeholder="请输入姓名" class="form-control" aria-label="Large"
								aria-describedby="inputGroup-sizing-sm" />
						</div>
						<div class="col">
							<select class="form-control" aria-label="Large"
								th:field="${student.grade.id}">
								<option value="">-请选择一个年级-</option>
								<option value="1">1年级</option>
								<option value="2">2年级</option>
								<option value="3">3年级</option>
								<option value="4">4年级</option>
							</select>
						</div>
						<div class="col">
							<button type="submit" class="btn btn-primary ">搜索</button>
						</div>
					</div>
				</div>
			</form>
			<br />
			<table class="table table-hover">
				<thead>
					<tr>
						<td>序号</td>
						<td>ID</td>
						<td>头像</td>
						<td>姓名</td>
						<td>性别</td>
						<td>年龄</td>
						<td>手机号</td>
						<td>学校</td>
						<td>年级</td>
						<td>班级</td>
						<td>创建时间</td>
						<td>操作</td>
					</tr>
				</thead>
				<tbody th:object="${studentPageBean}">
					<tr th:each="stu :*{list}">
						<td th:text="${stuStat.count}">序号</td>
						<td th:text="${stu.id}">ID</td>
						<td class="imgtd">
							<!-- <img th:src="@{'data:image/jpg;base64,'+''}" 
						width="100px" height="100px" id="imgId" />头像 -->
						</td>
						<td th:text="${stu.name}">姓名</td>
						<td th:text="${stu.sex} eq 1? '男':(${student.sex} eq 0? '女':'中性')">性别</td>
						<td th:text="${stu.age}">年龄</td>
						<td th:text="${stu.mobile}">手机号</td>
						<td th:text="${stu.school eq null} ? '无':${stu.school.name}">学校</td>
						<td th:text="${stu.grade eq null} ? '无':${stu.grade.name}">年级</td>
						<td th:text="${stu.clazz eq null} ? '无':${stu.clazz.name}">班级</td>
						<td th:unless="${stu.createDate} eq null"
							th:text="${#dates.format(stu.createDate,'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
						<td th:if="${stu.createDate} eq null">创建时间为空</td>
						<td><a href="#"
							th:href="@{/updateStudentHTML(studentId=${stu.id})}">编辑</a> <a
							href="#"
							th:href="@{/deleteStudent(id=${stu.id},currentPage=${studentPageBean.currentPage},school.name=${student.school} eq null ? '':${student.school.name},mobile=${student.mobile},name=${student.name},grade.id=${student.grade} eq null ? '':${student.grade.id})}">删除</a></td>
					</tr>
				</tbody>
			</table>
			<div th:include="page :: StudentPager" th:remove="tag"></div>
		</div>
	</div>
</body>
</html>
